<?php

require_once('../Model/Classes/PHPMailer/class.phpmailer.php');

$Name = $_REQUEST['Name'];
$Phone = $_REQUEST['Phone'];
$Email = $_REQUEST['Email'];
$Subject = $_REQUEST['Subject'];
$Message = $_REQUEST['Message'];

$mail = new PHPMailer();

//=====================================
// setup mail
//=====================================


$From = "thanhluong.ssp@gmail.com";
$EmailRev = "tranthanhluong90@gmail.com";
$mail->IsSMTP(); // call to class process SMTP
$mail->SMTPAuth = true;                   // login
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";           // SMPT
$mail->Port = 465;                        // port
$mail->Username = $From;                    // SMTP account username
$mail->Password = "tranthanhluong";         // SMTP account password

$mail->SetFrom($From, $Email);

// receive
$mail->AddAddress($EmailRev, "Lode");
$mail->AddReplyTo($Email,"Lode");
// reply
//$mail->AddReplyTo($Email,$Name);
// =====================================
// setup email
// =====================================
// title
$mail->Subject = $Subject . " from " . $Name;

// font
$mail->CharSet = "utf-8";

// content
$body = $Message;
$mail->Body = $body;
//attachment
//$mail->AddAttachment("attach.htm");

if (!$mail->Send()) {
    echo "Sorry, message delivery failed. Contact webmaster for more info." . $mail->ErrorInfo;
} else {
    echo "Mail send successfull!";
}
?>